package com.kitemap.widget.business
{
	import com.kitemap.widget.model.ProfileModel;
	
	import mx.utils.ObjectProxy;
	import mx.utils.ObjectUtil;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;	
	public class ProfileManager extends EventDispatcher
    {
        private var _profile:ProfileModel;
        public function setProfile(profile:Object):void 
        {
        	trace("setProfile:" + ObjectUtil.toString(profile));
        	if (profile) {
	            _profile = new ProfileModel(profile.key,
							            	profile.firstname,
							            	profile.url,
							            	profile.description);
	            dispatchEvent(new Event("profileChange"));
        	}
        }
        
        [Bindable (event="profileChange")]
        public function get profile():ProfileModel
        {
        	trace("Profile:" + _profile);
            return (_profile != null)?_profile:null;
        }
        
        public function handleFault(message:String):void {
            trace("Fault:" + message);
        }

    }
}